<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
use think\Request;

class Investhistory extends Controller
{
    public function investhistory(Request $request)
    {
   
        $callback = $request->param('callback');
    //	$sql = "select * from investhistory";
    //	$data = Db::table('Investhistory')->where('cid',$request->param('goods'))->select();
        // var_dump($data);die;
$data = Db::table('Investhistory')->alias('a')->field('time,account,a.money')->join('user c','a.uid = c.userId')->where('cid',$request->param('goods'))->select();
        if ($data) {
          foreach($data as $k=>$v){
            $data[$k]['tel1'] = substr($v['account'],0,3).'****'.substr($v['account'],7,4);
          }
            $arr['status'] = 200;
            $arr['data'] = $data; 
        }else{
            $arr['status'] = 400;
        }
         echo callback($callback,$arr);
        
    }
}   
